package com.example.bbs.controller;

import com.example.bbs.http.bean.type.HomePageData;
import com.example.bbs.service.TypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/api/type")
@Api(tags = {"分类接口"})

public class TypeController {

    @Autowired
    private TypeService typeService;

    @GetMapping("/")
    @ApiOperation("获得全部板块和分页")
    public String homePageInit(Model model) {
        HomePageData homePageData = typeService.homePageInit();
        model.addAttribute("types", homePageData);

        return "type";
    }

    @RequestMapping("/test")
    public String test(){

        return "login";
    }
    @RequestMapping("/test1")
    public String test1(){
        return "nav";
    }

}
